package cn.rcth.controller;

import cn.rcth.base.msg.ResultMsg;
import cn.rcth.base.serivce.IRechargeCarSerivce;
import cn.rcth.base.util.HttpRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class RechargeCardController {

    @Autowired
    private IRechargeCarSerivce rechargeCarSerivce;


    @RequestMapping(value = "/RechargeCard", method = RequestMethod.POST)
    @ResponseBody
    public ResultMsg RechargeCard(HttpServletRequest request,String card){
        //获取当前用户ip地址
        String ip = HttpRequest.getIpAddr(request);
        String password = rechargeCarSerivce.selectPasswordAndUpdateIp(ip,card);

        return ResultMsg.failedResult(password);
    }
}
